<img src="images/the_left_gradient.png" width="200px" height="0px" />
<h3 title="A Shorty Code is a command you can provide within your tweet which the tweetargs engine replaces with content.">Shorty Codes</h3>
<?php
	include_once("_args.php");

	$arrCommands = getCommands();

	foreach($arrCommands as $command)
	{
?>
		<div><a href="index.php?start=listing&arg=<?php echo $command[0]; ?>">--<?php echo $command[0]; ?>:</a> </div>
<?php
	}
?> 
<br />
<hr id="simplehr" />
<?php

	@session_start();
	$access_token = $_SESSION['access_token'];
	$arrUserCommands = getUserCommands($access_token['user_id'], false);


	echo "<h3>".$access_token['screen_name']."'s Shorty Codes</h3>";

	foreach($arrUserCommands as $command)
	{
?>
		<div><a href="index.php?start=listing&arg=<?php echo $command[0]; ?>">--<?php echo $command[0]; ?>:</a><br /><a href="index.php?start=share&type=scodes&typeid=<?php echo urlencode($command[0]); ?>&redirect=args"><img src="images/icon_share.jpg" border="0" alt="Share" title="Share" /></a><form action="_delete.php" method="post" onsubmit="return confirmDelete('<?php echo urlencode($command[0]); ?>');" id="inlineform"><input type="hidden" name="type" value="args" /><input type="hidden" name="redirect" value="args" /><input type="hidden" name="typeid" value="<?php echo urlencode($command[0]); ?>" /><input type="image" src="images/delete.gif" border="0" alt="Delete" title="Delete" /></form></div>
<?php
	}
	$arrUserCommands = getUserCommands($access_token['user_id'], true);

	foreach($arrUserCommands as $command)
	{
?>
		<div><a href="index.php?start=listing&arg=<?php echo $command[0]; ?>">--<?php echo $command[0]; ?>:</a><br /><a href="_accept.php?type=scodes&typeid=<?php echo urlencode($command[0]); ?>&redirect=args"><img src="images/accept.gif" border="0" alt="Accept" title="Accept" /></a><form action="_delete.php" method="post" onsubmit="return confirmDelete('<?php echo urlencode($command[0]); ?>');" id="inlineform"><input type="hidden" name="type" value="args" /><input type="hidden" name="redirect" value="args" /><input type="hidden" name="typeid" value="<?php echo urlencode($command[0]); ?>" /><input type="image" src="images/delete.gif" border="0" alt="Delete" title="Delete" /></form></div>
<?php
	}
?> 
<br />
<hr id="simplehr" />
<a href="index.php?start=createarg">Create a Shorty Code</a>
<script type="text/javascript">
function confirmDelete(stitle)
{
	var retval = "Are you sure you want to delete " + stitle + "?. There is no UNDO for this action (i.e. its going to be really, really deleted).";
	retval = confirm(retval);
	return retval;
}
</script>